| Total Complexity | 3 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Injectable } from '@nestjs/common'; |
||
| 4 | |||
| 5 | @Injectable() |
||
| 6 | export class RbacCache implements ICacheRBAC { |
||
| 7 | KEY = 'RBAC'; |
||
| 8 | TTL = 0; |
||
| 9 | |||
| 10 | private readonly cache; |
||
| 11 | |||
| 12 | constructor() { |
||
| 13 | this.cache = new NodeCache(); |
||
| 14 | } |
||
| 15 | |||
| 16 | get(): object | null { |
||
| 17 | return this.cache.get(this.KEY); |
||
| 18 | } |
||
| 19 | |||
| 20 | set(value: object): void { |
||
| 21 | this.cache.set(this.KEY, value, this.TTL); |
||
| 22 | } |
||
| 23 | |||
| 24 | del(): void { |
||
| 25 | this.cache.del(this.KEY); |
||
| 26 | } |
||
| 28 |